#include<iostream>
#include<cmath>
using namespace std;
int n, m;
int main()
{
	while (cin >> n >> m) {
		double ans = 1;
		double c = sqrt(n) + sqrt(m);
		ans = pow(c, 6);
		cout << (LL)ans + 1<< endl;
	}
	return 0;
}